package com.cq.hd.order.api;

import com.cq.hd.common.response.Result;
import com.cq.hd.order.api.dto.MonthSettleBillWithdrawalDto;
import com.cq.hd.order.api.vo.MonthSettleBillVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "hd-o2o-order-service", contextId = "month-settle-bill-api")
public interface TbMonthSettleBillApi {

    // 根据商户id，获取待提现的月度补贴结算单
    @GetMapping("/order/monthSettleBill/getMerchantWaitMonthSettleBill")
    Result<List<MonthSettleBillVo>> getMerchantWaitMonthSettleBill(@RequestParam("merchantId") Long merchantId, @RequestParam("type") Integer type);

    // 根据商户id，月度结算单id，获取待提现的结算单列表
    @GetMapping("/order/monthSettleBill/getAvailableMonthSettleBillByIds")
    Result<List<MonthSettleBillVo>> getAvailableMonthSettleBillByIds(@RequestParam("merchantId") Long merchantId, @RequestParam("ids") List<Long> ids);

    // 更新月度结算单提现状态并写入 提现-月度结算单 映射关系表
    @PostMapping("/order/monthSettleBill/withdrawalByDto")
    Result<Integer> withdrawalByDto(@RequestBody List<MonthSettleBillWithdrawalDto> monthSettleBillWithdrawalDtos);

    // 提现审核，更新月度结算单状态
    @PostMapping("/order/monthSettleBill/withdrawalUpdateStatus")
    Result<Boolean> withdrawalUpdateStatus(@RequestParam("withdrawalId") Long withdrawalId, @RequestParam("auditState") Integer auditState);

    /**
     * 执行月度结算，生成月度结算账单
     * 执行对象：orderSettleBill商户补贴
     */
    @PostMapping("/order/monthSettleBill/executeMonthlySettlement")
    Result<Boolean> executeMonthlySettlement();

    /**
     * 执行商户本金二次结算 for 结算池商户本金提现提现
     */
    @PostMapping("/order/monthSettleBill/executeMerchantAmtSettlement")
    Result<Boolean> executeMerchantAmtSettlement();

}
